package com.networkmanagerj.dao;

import java.util.ArrayList;
import java.util.List;

import br.com.networkmanagerj.exception.ExcecaoGenericaDAO;
import br.com.networkmanagerj.persistence.AbstractDAO;
import br.com.networkmanagerj.persistence.OrderType;

import com.networkmanagerj.model.AcaoMensagem;
import com.networkmanagerj.model.Usuario;

public class UsuarioDAO extends AbstractDAO<Usuario> {

	public UsuarioDAO(String puName) {
		super(puName);
	}

	public Usuario findByLogin(String login, String senha)
			throws ExcecaoGenericaDAO {
		Object[] parameters = { login, senha };
		ArrayList<Usuario> returnList = this.executeNamedQuery(
				"Usuario.findByLogin", parameters);
		if (returnList.size() == 0)
			return null;
		else
			return returnList.get(0);
	}

	@Override
	public List<Usuario> search(OrderType orderType)
			throws ExcecaoGenericaDAO {
		return search(Usuario.class, orderType);
	}

	@Override
	public Boolean isUsed(Usuario entity) throws ExcecaoGenericaDAO {
		return null;
	}
}
